#include "CheckBox.h"
#include "Application.h"

namespace MiniWindow
{

	CheckBox::CheckBox()
	{
	}
	CheckBox::CheckBox(const String& text) :Control(text)
	{
	}
	CheckBox::CheckBox(const String& text, int left, int top, int width, int height) : Control(text, left, top, width, height)
	{
	}

	const Type CheckBox::GetType() const
	{
		return Type(TEXT("MiniWindow::CheckBox"));
	}

	void CheckBox::Create()
	{
		DWORD style = BS_CHECKBOX | WS_VISIBLE | WS_CHILD | BS_NOTIFY;
		if (!this->_enabled)
		{
			style |= WS_DISABLED;
		}
		this->_handle = CreateWindowEx(
			0
			, TEXT("BUTTON")
			, this->_text
			, style
			, this->_position.x
			, this->_position.y
			, this->_size.cx
			, this->_size.cy
			, (null == this->Parent() ? null : this->Parent()->Handle())
			, null
			, Application::GetInstance()
			, this);
		Control::Create();
	}
	void CheckBox::Destroy()
	{
		Control::Destroy();
	}
}